package com.heima.Controller;


import com.heima.Server.UserServer;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojo.ApUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
public class UserController {

    @Autowired
    UserServer userServer;

    //    添加用户
    @PostMapping
     public ResponseResult Useradd(@RequestBody ApUser apUser)
    {
        return userServer.Useradd(apUser);
    }

    //删除用户
    @DeleteMapping("/{id}")
    public  ResponseResult UserDelete(Integer id)
    {
        return userServer.USerDelete(id);
    }


    //用户详情
    @GetMapping("/{id}")
    public ResponseResult Userinfo(@PathVariable Integer id)
    {
        return userServer.Userinfo(id);
    }

}
